package com.sangeng.controller;

import com.sangeng.domain.ResponseResult;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: xujiabing
 * @date: 2024-09-10 20:41
 * @description 控制器
 */
@RestController
public class HelloController {

    /**
     * 权限校验-用户有对应权限才能访问此接口
     * @return
     */
    //@PreAuthorize("hasAuthority('system:dept:list')")
    @PreAuthorize("@ex.hasAuthority('system:dept:list')")
    @RequestMapping("/hello")
    public String hello(){
        return "hello";
    }

    /**
     * 测试接口
     * @return
     */
    @RequestMapping("/testCors")
    public ResponseResult testCors() {
        return new ResponseResult(200,"testCors");
    }
}
